package com.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.base.BaseDaoImpl;
import com.dao.VoteDao;
import com.entity.Vote;
import com.util.Page;

@Repository
public class VoteDaoImpl extends BaseDaoImpl<Vote> implements VoteDao {

	@Override
	public Page getVoteExcludeCurrUser(int uid,Page p) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("vuid", uid);
		return super.getPageByHql("from Vote where vid not in(select vote.vid from UserVote where voteUser.vuid = :vuid)", map,p);
	}

	@Override
	public Page getVoteByType(int vtid,Page p) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("vtid", vtid);
		return super.getPageByHql("from Vote where voteType.vtId = :vtid", map, p);
	}
}
